package com.digitalchina.lxnsy.api;

import android.app.Activity;
import android.os.Handler;

import com.digitalchina.lxnsy.constant.MSG;
import com.digitalchina.lxnsy.constant.URL;
import com.digitalchina.lxnsy.toolkit.OkHttpUtil;
import com.digitalchina.lxnsy.xml.UserXML;
import com.lzy.okhttputils.model.HttpParams;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.api
 * 创建人：郑皓
 * 创建时间：2017/12/14 17:03
 * 修改备注：
 * ================================================
 */
public class BusinessMyFarm {

    /**
     * 我的农场列表
     *
     * @param activity
     * @param handler
     */
    public static void farmList(Activity activity, Handler handler) {

        HttpParams params = new HttpParams();
        params.put("useraccId", UserXML.getUserId(activity));

        OkHttpUtil.post(activity, URL.URL_FARM_LIST, "", params, handler, MSG.MSG_FARM_LIST_SUCCESS, MSG.MSG_FARM_LIST_FIELD);

    }


    /**
     * 保存农场信息
     * @param activity
     * @param oneStageCode
     * @param twoStageCode
     * @param threeStageCode
     * @param estateNumber
     * @param handler
     */
    public static void saveFam(Activity activity, String oneStageCode,String twoStageCode,String threeStageCode, String estateNumber, Handler handler) {

        HttpParams params = new HttpParams();
        params.put("useraccId", UserXML.getUserId(activity));
        params.put("oneStageCode", oneStageCode);
        params.put("twoStageCode", twoStageCode);
        params.put("threeStageCode", threeStageCode);
        params.put("estateNumber", estateNumber);

        OkHttpUtil.post(activity, URL.URL_SAVE_FARM, "", params, handler, MSG.MSG_SAVE_FARM_SUCCESS, MSG.MSG_SAVE_FARM_FIELD);

    }

    /**
     * 农场信息ID
     *
     * @param activity
     * @param id
     * @param handler
     */
    public static void deleteFarm(Activity activity, String id, Handler handler) {

        HttpParams params = new HttpParams();
        params.put("id", id);

        OkHttpUtil.post(activity, URL.URL_DELETE_FARM, "", params, handler, MSG.MSG_DELETE_FARM_SUCCESS, MSG.MSG_DELETE_FARM_FIELD);

    }
}
